#ifndef _SPI_CTRL_H_
#define _SPI_CTRL_H_

#include "gd32f3x0.h"

#define SPI_TUNER_CH            SPI3

void SPI_Config(void);
void SPI_RXDMAConfig(uint32_t SPIx, unsigned char* pBuffer, int size);
void SPI_EnableDMARX(uint32_t SPIx);
void SPI_DisableDMARX(uint32_t SPIx);
void SPI_TXDMAConfig(uint32_t SPIx, unsigned char* pBuffer, int size);
void SPI_EnableDMATX(uint32_t SPIx);
void SPI_DisableDMATX(uint32_t SPIx);

int  SPI_Tuner_BufferWrite(uint8_t* pBuffer, uint16_t NumByteToWrite);
int  SPI_Tuner_BufferRead(uint8_t* pBuffer, uint16_t NumByteToRead);

#endif

